var noticeUrlMapping = [
  {
    'url': 'salesBusiness',
    'noticeCode': ['SALE_VEHICLE_NOTICE', 'NOTICE_OF_CHANGE_OF_SALE_VEHICLE']
  },
  {
    'url': 'salesCommodity',
    'noticeCode': ['GOODS_ACCESSORIES_LACK']
  },{
    'url': 'salesOrder',
    'noticeCode': ['TAIL_CONFIRMATION_NOTICE', 'ADMIN_VEHICLE_LOCK', 'INVOICE_WAIT', 'TICKETING_AND_DISMISSING', 'LICENSE_UPLOAD_CONFIRM', 'CUSTOMER_INFO_WAIT_CONFIRM_BY_SALESMAN', 'ORDER_RESOURCE_UPLOAD_BANKSHIP_DEPOSIT', 'ORDER_RESOURCE_UPLOAD_BANKSHIP_FULL', 'ORDER_RESOURCE_UPLOAD_BANKSHIP_BALANCE', 'SECURITY_DEPOSIT_RETURN_REMINDER', 'BILLING_INFORMATION_TO_BE_AUDITED', 'CUSTOMER_INFO_WAIT_AUDIT']
  },{
    'url': '',
    'noticeCode': ['DEPOSIT_OR_FULL_AUDIT_PASS_FOR_KEEPER', 'ORDER_CAR_VALIDATE_DATE_CHANGED', 'ORDER_CAR_VALIDATE_EXAMINER_CHANGED', 'DEPOSIT_OR_FULL_AUDIT_PASS_FOR_SALESMAN', 'BALANCE_CONFIRM', 'ORDER_CAR_VALIDATE_DATE_CHANGED', 'ORDER_CAR_VALIDATE_EXAMINER_CHANGED', 'TO_PASS_THROUGH']
  }
]
const noticeUrl = {
  state: {
    url: ''
  },

  mutations: {
    GET_URL: (state, url) => {
      state.url = url
    }
  },

  actions: {
    getUrlByCode({ commit }, code) {
      // 页面传进code，在数组mapping找到对应的url，后提交
      var noticeUrlArr = noticeUrlMapping.filter((item) => {
        return item.noticeCode.includes(code)
      })
      if (noticeUrlArr.length === 0) {
        console.log(`跳转路径映射表缺省CODE:${code}`)
        return
      }
      commit("GET_URL", noticeUrlArr[0].url)
    }
  }
}
export default noticeUrl
